package com.gperp.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.gperp.common.GPResult;
import com.gperp.pojo.AsSystemconfig;
import com.gperp.pojo.AsSystemconfigExample;
import com.gperp.pojo.Result;
import com.gperp.service.AsSystemconfigService;

@Controller
@CrossOrigin
@ResponseBody
@RequestMapping("systemconfig")
public class AsSystemconfigController {

	@Autowired
	private AsSystemconfigService asSystemconfigService;
	
	/**
	 * 财务类型的查询所有
	 * @param example
	 * @param response
	 * @return
	 */
	@RequestMapping(path="query",method=RequestMethod.POST)
	public Result selectByExample(int page,int rows,int configtype) {
		//调用服务查询商品列表
		Result list=asSystemconfigService.selectFinance(page,rows, configtype);
		return list;
	}
	/**
	 * 添加财务
	 * @param record
	 * @return
	 */
	@RequestMapping(path="add",method=RequestMethod.POST)
	public GPResult insertSelective(String configtypename,int isstart,int configType){
		return asSystemconfigService.insertFinance(configtypename, isstart, configType);
		
	}
	/**
	 * 根据id查询
	 * @param id
	 * @return
	 */
	@RequestMapping(path="queryById",method=RequestMethod.GET)
	public AsSystemconfig selectByPrimaryKey(Long id){
		return asSystemconfigService.selectByPrimaryKey(id);
	}
	/**
	 * 修改财务
	 * @param record
	 * @return
	 */
	@RequestMapping(path="up",method=RequestMethod.POST)
	public int updateByPrimaryKey(AsSystemconfig record){
		return asSystemconfigService.updateByPrimaryKey2(record);
		
	}
	
	
	/**
	 * 删除
	 * @param record
	 * @return
	 */
	@RequestMapping(path="del",method=RequestMethod.GET)
	public int financeTypedel(Long id){
		return asSystemconfigService.deleteByPrimaryKey(id);
		
	}
	    /**
	     * 包含分页，查询所有
	     * @param page
	     * @param rows
	     * @param example
	     * @return
	     */
		@RequestMapping(value="selectpage",method=RequestMethod.POST)
		public Result getlikePortalList(Integer page,Integer rows,int configtype){
			//调用服务查询商品列表
			Result list=asSystemconfigService.selectFinance(page,rows,configtype);
			return list;
		}
		/**
		 * 财务类型的查询所有
		 * @param example
		 * @param response
		 * @return
		 */
		@RequestMapping(path="queryService",method=RequestMethod.POST)
		public Result selectService(int page,int rows,int configtype) {
			//调用服务查询商品列表
			Result list=asSystemconfigService.selectService(page, rows, configtype);
			return list;
		}
		
		/**
		 * 添加服务
		 * @param record
		 * @return
		 */
		@RequestMapping(path="addservice",method=RequestMethod.POST)
		public GPResult insertService(String configtypename,int isstart,String configvalue,int configType){
			return asSystemconfigService.insertService(configtypename, isstart, configvalue, configType);
		}
		
		/**
		 * 修改服务
		 * @param record
		 * @return
		 */
		@RequestMapping(path="updateService",method=RequestMethod.POST)
		public int updateService(AsSystemconfig record){
			return asSystemconfigService.updateService(record);
			
		}
		
		/**
		 * 修改客户
		 * @param record
		 * @return
		 */
		@RequestMapping(path="updateClient",method=RequestMethod.POST)
		public GPResult updateService(String configtypename, int isstart,int configType,Long id){
			return asSystemconfigService.updateClient(configtypename, isstart, configType,id);
			
		}
		
		/**
		 * 查询App
		 * @param record
		 * @return
		 */
		@RequestMapping(path="selectApp",method=RequestMethod.POST)
		public AsSystemconfig selectApp(AsSystemconfigExample example){
			return asSystemconfigService.selectApp(example);
			
		}
		/**
		 * 更改App
		 * @param record
		 * @return
		 */
		@RequestMapping(path="updateApp",method=RequestMethod.POST)
		public int updateApp(AsSystemconfig record){
			return asSystemconfigService.updateApp(record);
		}
		/**
		 * 查询服务年限
		 * @param record
		 * @return
		 */
		@RequestMapping(path="selectServiceYear",method=RequestMethod.POST)
		public AsSystemconfig selectServiceYear(AsSystemconfigExample example){
			return asSystemconfigService.selectServiceYear(example);
			
		}
		
		/**
		 * 更改服务年限
		 * @param record
		 * @return
		 */
		@RequestMapping(path="updateServiceYear",method=RequestMethod.POST)
		public int updateServiceYear(AsSystemconfig record){
			return asSystemconfigService.updateServiceYear(record);
		}
		
		/**
		 * 更改服务年限
		 * @param record
		 * @return
		 */
		@RequestMapping(path="querLogs",method=RequestMethod.POST)
		public Result queryLogs(int page, int rows){
			return asSystemconfigService.selectLogs(page, rows);
		}

}
